const Router = require('koa-router')

const {userValidator,cd,verifyUser,verifyLogin,cryptPassword} = require('../middleware/user.middleware')
const {auth} = require('../middleware/auth.middleware')
const {register,login,updatePassword} = require('../controller/user.controller')

const router = new Router({prefix:'/users'})

//注册接口
router.post('/register',userValidator,verifyUser,cryptPassword,register)
//登录接口
router.post('/login',userValidator,verifyLogin,login)
//修改密码接口
router.patch('/',auth,cd,cryptPassword,updatePassword)
module.exports = router